/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author User
 */
@ManagedBean
@SessionScoped
public class AccesBean {
    
private String name;
private String password;
private String user;
    /**
     * Creates a new instance of AccesBean
     */
    public AccesBean() {
    }
///////////metodos get y set
     public String getName() {
        System.out.println("entro al get");
        return name;
    }

    public void setName(String name) {
        System.out.println("entro al set");
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    
    
    /////acciones
    public String procesrAccion(){
   
        return null;
    }
    
    
    public String validarLogin(){
    if(name.equals("Estudiante")&password.equals("123")){
        
        
        ////////////////////////////////// Loggear
        
     
        FacesContext context = FacesContext.getCurrentInstance();
    context.getExternalContext().getSessionMap().put("Usuario_Loggeado", user);
        
    
    
    
    return "PaginaPrincipal";
    }else{
    return "Pagina2";
    }
    }
    
    
}
